<script setup>
import Home from "./views/Home.vue";
import User from "./views/User.vue";
import {ref, markRaw} from "vue";

const selectPage = ref(null);

function changePage(page) {
  selectPage.value = markRaw(page);
}

changePage(Home);

</script>

<template>
  <div class="main">
    <button @click="changePage(Home)">切换到首页</button>
    <button @click="changePage(User)">切换到用户页</button>
    <component :is="selectPage"></component>
  </div>
</template>
<script>
export default {
  name: "Main"
}
</script>
<style scoped>

</style>